/***************************************************************************
 *   Copyright (C) 2008 by Chris Vickery   *
 *   chrisinajar@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef MAINAPPLICATION_H
#define MAINAPPLICATION_H

#include <QObject>
#include <QTime>
#define main SDL_main
#include "SDL.h"
#undef main

class SpaceShip;

/**
	@author Chris Vickery <chrisinajar@gmail.com>
*/
class MainApplication : public QObject
{
	Q_OBJECT
public:
	enum Key
	{
		KeyA = 0x00000001,
		KeyB = 0x00000002,
		KeyC = 0x00000004,
		KeyD = 0x00000008,
		KeyE = 0x00000010,
		KeyF = 0x00000020,
		KeyG = 0x00000040,
		KeyH = 0x00000080,
		KeyI = 0x00000100,
		KeyJ = 0x00000200,
		KeyK = 0x00000400,
		KeyL = 0x00000800,
		KeyM = 0x00001000,
		KeyN = 0x00002000,
		KeyO = 0x00004000,
		KeyP = 0x00008000,
		KeyQ = 0x00010000,
		KeyR = 0x00020000,
		KeyS = 0x00040000,
		KeyT = 0x00080000,
		KeyU = 0x00100000,
		KeyV = 0x00200000,
		KeyW = 0x00400000,
		KeyX = 0x00800000,
		KeyY = 0x01000000,
		KeyZ = 0x02000000
	};
	Q_DECLARE_FLAGS(Keys, Key)
	MainApplication(QObject *parent = 0);
	Key sdlKeyToKey(SDLKey k);
	~MainApplication();
private slots:
	void iterate();
protected:
	Keys pressedKeys;
	SDL_Surface* screen;
	SDL_Surface* buff;
	int i;
	int height;
	int width;
	QTime timer;
	SpaceShip* ship;


};

Q_DECLARE_OPERATORS_FOR_FLAGS(MainApplication::Keys)

#endif
